<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
      <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" /> 
    <title>{$System_namex}</title>
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/Css/semantic.css"/>
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/Css/main.css">
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/Css/common.css">

    <script src="__PUBLIC__/Js/jquery-1.11.3.min.js"></script>
    <script type="text/javascript">document.write("<scr"+"ipt src=\"__PUBLIC__/Js/Base.js\"></sc"+"ript>")</script>
    <script type="text/javascript">document.write("<scr"+"ipt src=\"__PUBLIC__/Js/prototype.js\"></sc"+"ript>")</script>
    <script type="text/javascript">document.write("<scr"+"ipt src=\"__PUBLIC__/Js/mootools.js\"></sc"+"ript>")</script>
    <script type="text/javascript">document.write("<scr"+"ipt src=\"__PUBLIC__/Js/Ajax/ThinkAjax.js\"></sc"+"ript>")</script>
    <script type="text/javascript">document.write("<scr"+"ipt src=\"__PUBLIC__/Js/Form/CheckForm.js\"></sc"+"ript>")</script>
    <script type="text/javascript">document.write("<scr"+"ipt src=\"__PUBLIC__/Js/common.js\"></sc"+"ript>")</script>
    <script type="text/javascript">document.write("<scr"+"ipt src=\"__PUBLIC__/Js/Util/ImageLoader.js\"></sc"+"ript>")</script>
    <script type="text/javascript">document.write("<scr"+"ipt src=\"__PUBLIC__/Js/myfocus-1.0.4.min.js\"></sc"+"ript>")</script>
    <script type="text/javascript">document.write("<scr"+"ipt src=\"__PUBLIC__/Js/all.js\"></sc"+"ript>")</script>
    <!--<script language="JavaScript">
    ifcheck = true;
    function CheckAll(form)
    {
        for (var i=0;i<form.elements.length-2;i++)
        {
            var e = form.elements[i];
            e.checked = ifcheck;
        }
        ifcheck = ifcheck == true ? false : true;
    }
    </script>-->
    <script>
        //function checkLeave(){
        //	window.parent.stateChangeIE();
        //}
    </script>
    <script>
        jQuery(function(){
            jQuery("#AllX").click(function(){
                var t=jQuery("#tb1 input[type='checkbox']").prop('checked')
                //a
                if(t==true){
                    jQuery("#tb1 input[type='checkbox']").prop({"checked":false})


                }else{
                    jQuery("#tb1 input[type='checkbox']").prop({"checked":true})
                }
            })

        })
    </script>
    <style type="text/css">
        td, th {
            padding: 0;
            padding:3px;
            border: 1px #eee solid;
            font-size: 12px;
            color: #333;

        }
        table {
            border-collapse: collapse;
            border-spacing: 0;
            background: #fff;
            width: 100%;
            padding-bottom: 15px;
        }
        thead{background-color: #d4d4d5;}
        .accounttitle h1{
            text-align: center;
            padding: 5px;
            font-size: 16px;
        }
        .ncenter_box{background-color: #fff;padding:10px;}

         td{
                min-width: 70px;
            }
              @media (max-width: 414px){
          
            #editor{
                width:90% !important;
            }
              #edui87_iframe{
            width: 60% !important;
        }
        #edui87_body{
            width: 412px !important;
        }
        }
        @media (max-width: 375px){
           td{
                min-width: 70px;
            }
            #editor{
                width: 82% !important;
            }
             #edui87_body{
            width: 372px !important;
        }
        }
        @media (max-width: 320px){
             #editor{
                width:72% !important;
            }
             #edui87_body{
            width: 318px !important;
        }
        }
    </style>
</head>
<body>
<script type="text/javascript" charset="utf-8" src="__PUBLIC__/Ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="__PUBLIC__/Ueditor/ueditor.all.min.js"> </script>
<!--建议手动加在语言，避免在ie下有时因为加载语言失败导致编辑器加载失败-->
<!--这里加载的语言文件会覆盖你在配置项目里添加的语言类型，比如你在配置项目里配置的是英文，这里加载的中文，那最后就是中文-->
<script type="text/javascript" charset="utf-8" src="__PUBLIC__/Ueditor/lang/zh-cn/zh-cn.js"></script>
<script type="text/javascript" charset="utf-8" src="__PUBLIC__/Js/jquery-1.11.3.min.js"></script>
<div class="accounttitle"><h1>产品编辑</h1></div>
<div class="ncenter_box">
    <table cellpadding=3 cellspacing=0 width=100% >
        <form method='post' id="form1" name="form1" action="__URL__/pro_edit_save"  enctype="multipart/form-data">
            <tr>
                <td width="15%" align="right">产品名称：</td>
                <td><input id='title' type="text" class="huge bLeftRequire" name="title"	size="40" maxlength="40" value="{$rs.name}"></td>
            </tr>
            <tr>
                <td height="22" align="right">商品编号：</td>
                <td><input id='cid' type="text"  name="cid" size="40" maxlength="40" value="{$rs.cid}"></td>
            </tr>
            <tr>
                <td height="22" align="right">产品分类：</td>
                <td>
                    <!-- 一级分类	 -->
                    <select name="cptype" id="cptype" style="width:30%;float:left;">
                        <volist name="list" id="productType">
                            <option value="{$productType.id}" <eq name="rs.cptype" value="$productType.id">selected</eq>>{$productType.tpname}</option>
                        </volist>
                    </select>
                    <!-- 二级分类 -->
                    <select name="cptype" id="cptype2" style="width:30%;float:left;margin-left:10px;">
                        <volist name='list2' id='voo'>
                            <option value="{$voo['id']}" <eq name="rs.cptype" value="$voo['id']">selected</eq>>{$voo['tpname']}</option>
                        </volist>
                    </select>
                </td>
            </tr>
            <tr style="display:none">
                <td height="22" align="right">尺寸：</td>
                <td><input type="text"  name="ccname" size="40" maxlength="100" value="{$rs.ccname}"></td>
            </tr>
            <tr style="display:none">
                <td height="22" align="right">型号：</td>
                <td><input type="text"  name="xhname" size="40" maxlength="100" value="{$rs.xhname}"></td>
            </tr>
            <tr style="display: none;">
                <td height="22" align="right">成本：</td>
                <td><input type="text" name="a_money" id="a_money" value="{$rs.a_money}" size="10" maxlength="10" value="666666"></td>
            </tr>
            <tr>
                <td height="22" align="right">售价：</td>
                <td><input type="text" name="money" id="money" value="{$rs.money}" size="10" maxlength="10"></td>
            </tr>
            <tr style="display: none;">
                <td height="22" align="right"></td>
                <td><input type="checkbox" name="is_dz" id="is_dz" value="1" size="10" {:$rs['is_dz']==1?'checked="checked"':''}>开启打折</td>
            </tr>
            <tr style="display:none">
                <td height="22" align="right">批发价：</td>
                <td><input type="text" name="b_money" id="b_money" value="{$rs.b_money}" size="10" maxlength="10"></td>
            </tr>
            <tr>
                <td align="right">图片：</td>
                <td class="center"><input name="image" type="text" id="image" value="{$rs.img}" size="50" maxlength="500" />
                    <p>外部地址请填写“http://”为开头的地址</p></td>
            </tr>
            <tr>
                <td align="right">本地上传：</td>
                <td class="center"><iframe src="__URL__/upload_add" width="350" height="80" scrolling="no" frameborder="0"></iframe>上传格式：jpg, gif, png, jpeg</td>
            </tr>
            <tr><td colspan="2">内容：</td></tr>
            <tr>
                <td colspan="2">
                    <script id="editor"  type="text/plain" name='aaabbb' style="width:100%;height:500px;">
	         <?php echo $rs['content']; ?>
	    </script>
                </td>
            </tr>

            <tr>
                <td align="right">发布时间：</td>
                <td><input name="ctime" id="ctime" type="text" value="{$rs.create_time|date='Y-m-d H:i:s',###}" /></td>
            </tr>
            <tr>
                <td></td>
                <td class="center">
                    <input type="hidden" class="huge bLeftRequire" name="ID" id="ID" value="{$rs['id']}">
                    <span onclick="gengxin();" style="display: block; width:56px; height:40px; line-height:40px; text-align: center; border:1px;background:#459E86; border-radius:3px; color:#fff;margin-top:6px; cursor:pointer;">更新</span>
                </td>
            </tr>
        </form>
    </table>
</div>

<script type="text/javascript">
    $("#cptype").on('change',function(){
        var class1 = $(this).val();
        $.post("__URL__/find_class_two",{"class":class1},function(data){
            // console.log(data);
            $("#cptype2").empty();
            $("#cptype3").empty();
            $.each(data,function(index,elem){
                // console.log(elem);
                $("#cptype2").append("<option value='"+elem.id+"'>"+elem.tpname+"</option>");
            });
        })
    });

</script>
<script type="text/javascript">
    function gengxin(){
        var cp_content	=UE.getEditor('editor').getContent();
        var title		=$('#title').val();
        var cid			=$('#cid').val();
        var cptype		=$('#cptype').val();
        var cptype2		=$('#cptype2').val();
        var money		=$('#money').val();
        var a_money       =$('#a_money').val();
        var image		=$('#image').val();
        var ID			=$('#ID').val();
         if($('#is_dz').is(':checked')){
            var is_dz=1;
        }else{
            var is_dz=0;
        }

        $.post("__APP__/Gouwu/pro_edit_save",{cp_content:cp_content, title:title,cid:cid,cptype:cptype,cptype2:cptype2,money:money,image:image,ID:ID,a_money:a_money,is_dz:is_dz},function(data){
            alert(data);
            if (data == '编辑成功!'){
                window.location.href='__URL__/pro_index';
            }
        });
    }

    //实例化编辑器
    //建议使用工厂方法getEditor创建和引用编辑器实例，如果在某个闭包下引用该编辑器，直接调用UE.getEditor('editor')就能拿到相关的实例
    var ue = UE.getEditor('editor', {
        toolbars: [
            ['fullscreen', 'undo', 'redo', 'bold', 'italic', 'underline', 'fontborder', 'backcolor', 'fontsize', 'fontfamily', 'justifyleft', 'justifyright', 'justifycenter', 'justifyjustify', 'strikethrough', 'superscript', 'subscript', 'removeformat', 'formatmatch', 'autotypeset', 'blockquote', 'pasteplain', '|', 'forecolor', 'backcolor', 'insertorderedlist', 'insertunorderedlist', 'selectall', 'cleardoc',  'emotion','preview','insertimage']
        ]
    });
    function getContent() {
        var arr = [];
        arr.push("使用editor.getContent()方法可以获得编辑器的内容");
        arr.push("内容为：");
        arr.push(UE.getEditor('editor').getContent());
        alert(arr.join("\n"));
    }

</script>

<div style="height: 100px"></div>

<include file="Public:footer" />